package validator;

import exception.ParamCheckFailureException;

/**
 * 校验器接口，定义常用的校验方法
 *
 * @Author 小白龙
 * @Date 2021-01-05
 * @Version 1.0
 */
public interface IValidate<T> {

    /**
     * 不能为空
     *
     * @param errorMessage
     * @return
     * @throws ParamCheckFailureException
     */
    T notNull(String errorMessage) throws ParamCheckFailureException;

    /**
     * 不能为空
     *
     * @return
     * @throws ParamCheckFailureException
     */
    T notNull() throws ParamCheckFailureException;

    /**
     * 校验最小值
     *
     * @param min
     * @return
     * @throws ParamCheckFailureException
     */
    T min(int min) throws ParamCheckFailureException;

    /**
     * 校验最小值
     *
     * @param min
     * @param errorMessage
     * @return
     * @throws ParamCheckFailureException
     */
    T min(int min, String errorMessage) throws ParamCheckFailureException;

    /**
     * 校验最大值
     *
     * @param max
     * @param errorMessage
     * @return
     * @throws ParamCheckFailureException
     */
    T max(int max, String errorMessage) throws ParamCheckFailureException;

    /**
     * 校验最大值
     *
     * @param max
     * @return
     * @throws ParamCheckFailureException
     */
    T max(int max) throws ParamCheckFailureException;

    /**
     * 校验长度
     *
     * @param min
     * @param max
     * @param errorMessage
     * @return
     * @throws ParamCheckFailureException
     */
    T length(int min, int max, String errorMessage) throws ParamCheckFailureException;

    /**
     * 校验长度
     *
     * @param min
     * @param max
     * @return
     * @throws ParamCheckFailureException
     */
    T length(int min, int max) throws ParamCheckFailureException;
}
